using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;
using DevExpress.XtraEditors;
using DAL;
using BLL;
using DTO;

namespace WellmeadowsHospital
{
    public partial class frmSearchOutPatients : DevExpress.XtraEditors.XtraUserControl
    {
        AppointmentBLL appointmentBLL = new AppointmentBLL();
        WardBLL wardBLL = new WardBLL();
        PatientBLL patientBLL = new PatientBLL();
        ListWaitBLL listwaitBLL = new ListWaitBLL();
        OutPatientsBLL outpatientsBLL = new OutPatientsBLL();
        StaffBLL staffBLL = new StaffBLL();
        public frmSearchOutPatients()
        {
            InitializeComponent();
            gridControl6.DataSource = outpatientsBLL.SearchAll();
        }

        private void textEdit95_KeyPress(object sender, KeyPressEventArgs e)
        {
            string key = textEdit95.Text;
            if (!key.Equals(""))
            {
                gridControl6.DataSource = outpatientsBLL.Search(key);
            }
            else
            {
                gridControl6.DataSource = outpatientsBLL.SearchAll();
            }
        }

        private void gridView15_RowClick(object sender, DevExpress.XtraGrid.Views.Grid.RowClickEventArgs e)
        {
            try
            {
                string staffid = gridView15.GetRowCellValue(gridView15.GetSelectedRows()[0], gridColumn89).ToString();
                gridControl7.DataSource = staffBLL.Search(staffid);
            }
            catch (Exception ee)
            {
                MessageBox.Show(ee.Message);
            }
        }
    }
}
